<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Zero Defect 项目管理</title>
    <link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../static/css/dashboard.css" rel="stylesheet"/>
    <link href="../static/css/sticky-footer-navbar.css" rel="stylesheet"/>
    <style type="text/css" rel="stylesheet">
        .footer {
            width: 75%;
        }

        .sidebar {
            top: 50px;
        }
        .count-table {
            text-align: center;
            color: #333333;
        }
        .count-table td {
            border: solid 1px #AAAAAA;
            padding: 5px;
        }
        .limit-width {
            max-width: 200px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .limit-width:hover {
            position: fixed;
            max-width: 600px;
            width: 600px;
            background-color: #CCCCCC;
            text-overflow:inherit;
            white-space: normal;
            overflow:visible;
        }
    </style>
    <script src="../static/js/lib/jquery.min.js"></script>
    <script src="../static/js/lib/bootstrap.min.js"></script>
    <script src="../static/js/lib/163-angular.min.js"></script>
    <script src="../static/js/app.js"></script>
    <script src="../static/js/project.js"></script>
    <script src="../static/js/idService.js"></script>
    <script src="../static/js/commonService.js"></script>
    <script type="application/javascript">
    </script>
</head>
<body ng-app="app" ng-controller="projectCtrl">
<!-- 导航 -->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-header brand">
        <a class="navbar-brand" href="#">Zero Defect</a>
    </div>
    <div class="container">
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown" ng-if="isDeveloper || isRequire || isTester">
                    <a href="/defect" clasks="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">当前工作<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li class="dropdown-header">当前工作</li>
                        <li><a href="/defect">待办工作</a></li>
                        <li><a href="/defect">提出问题</a></li>
                        <li role="separator" class="divider">历史工作</li>
                        <li class="dropdown-header">历史工作</li>
                        <li><a href="/defect">我提出的问题</a></li>
                        <li><a href="/defect">我解决的问题</a></li>
                    </ul>
                </li>
                <li><a href="/user" ng-if="isManager">系统管理</a></li>
                <li class="active">
                    <a href="/project" ng-if="isDeveloper || isRequire || isTester">项目管理</a>
                </li>
                <li><a href="/about">关于</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">{{principle.firstName}} ({{principle.id}}) <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">设置</a></li>
                        <li><a href="/exit">退出</a></li>
                    </ul>
                </li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 sidebar">
            <ul class="nav nav-sidebar">
                <li ng-click="showProList()"><a href="#"><span class="text-info glyphicon glyphicon-list"> </span>  项目列表</a></li>
                <li><a href="#" data-toggle="modal" data-target="#imgModal"><span class="text-info glyphicon glyphicon-plus"> </span> 新建项目</a></li>
                <li><a href="#">其他</a></li>
                <li class="nav-divider"></li>
            </ul>
            <ul class="nav nav-sidebar" ng-if="showDefect" ng-init="proCount(countPro.code)">
                <li><a class="text-danger">项目信息：</a></li>
                <li><a>项目名称：{{countPro.name}} ({{countPro.code}})</a></li>
                <li><a>项目负责人：{{countPro.manager}}</a></li>
                <li class="nav-divider"></li>
                <li><a class="text-danger">问题统计：</a></li>
                <li>
                    <a>
                        <table cellspacing="0" class="count-table col-sm-12">
                            <tr>
                                <td>一般</td>
                                <td>普通</td>
                                <td>重要</td>
                                <td>紧急</td>
                                <td>非常紧急</td>
                                <td>总计</td>
                            </tr>
                            <tr>
                                <td>{{rank1}}</td>
                                <td>{{rank2}}</td>
                                <td>{{rank3}}</td>
                                <td>{{rank4}}</td>
                                <td>{{rank5}}</td>
                                <td rowspan="3">{{hasResolved+notResolved}}</td>
                            </tr>
                            <tr>
                                <td colspan="3">已解决</td>
                                <td colspan="2">未解决</td>
                            </tr>
                            <tr>
                                <td colspan="3">{{hasResolved}}</td>
                                <td colspan="2">{{notResolved}}</td>
                            </tr>
                        </table>
                    </a>
                </li>
            </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 main">
            <section class="col-sm-12" ng-if="showPro">
                <h2 class="sub-header">项目列表</h2>
                <div class="table-responsive">
                    <table class="table table-striped" ng-init="getAll()">
                        <thead>
                        <tr>
                            <th>项目标识</th>
                            <th>项目名称</th>
                            <th>项目负责人</th>
                            <th>项目代码</th>
                            <th>默认项目</th>
                            <th>删除</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="pro in proList">
                            <td>{{pro.code}}</td>
                            <td ng-click="listDefect(pro)">
                                <a href="#" class="text-primary">{{pro.name}}</a>
                            </td>
                            <td>{{pro.manager}}</td>
                            <td>{{pro.sn}}</td>
                            <td>
                                {{pro.prefer ? "默认" : ""}}
                                <a href="#" ng-click="setPrefer(pro.code)" class="text-primary">{{pro.prefer ? "" : "置为默认"}}</a>
                            </td>
                            <td>
                                <b><span class="text-danger glyphicon glyphicon-remove" ng-click="delete(pro.code)"> </span> </b>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </section>

            <section class="col-sm-12" ng-if="showDefect">
                <h2 class="sub-header">项目问题</h2>
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>等级</th>
                            <th>项目</th>
                            <th>内容</th>
                            <th>是否解决</th>
                            <th>处理人</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="defect in defectList">
                            <td>{{defect.code}}</td>
                            <td>{{defect.rank | reverse}}</td>
                            <td>{{defect.projectId}}</td>
                            <td class="limit-width">
                                {{defect.content}}
                            </td>
                            <td>{{defect.finished ? "是" : "否"}}</td>
                            <td>{{defect.assignee}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </section>

        </div>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="imgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">新建项目</h4>
            </div>
            <div class="modal-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目标识：</label>
                        <div class="col-sm-8">
                            <input ng-model="pro.code" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目名称：</label>
                        <div class="col-sm-8">
                            <input ng-model="pro.name" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">负责人：</label>
                        <div class="col-sm-8">
                            <select ng-model="pro.manager" class="form-control" ng-options="dev.userId as dev.name for dev in devList">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目代码：</label>
                        <div class="col-sm-8">
                            <input ng-model="pro.sn" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary" ng-click="add()">确定</button>
                &nbsp; &nbsp;
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            </div>
        </div>
    </div>
</div>

<!-- 页脚 -->
<footer class="footer col-sm-offset-3 col-sm-9">
    <div class="container col-sm-9">
        <p class="text-muted">Zero Defect. 版权所有 2018.02.04</p>
    </div>
</footer>


</body>
</html>